Skip to content

[storage/qmdb] specialize the (common) k=2 case in apply_batch#3769

Draft
roberto-bayardo wants to merge 4 commits into
unsafe-index-2from
specialize-depth-2
Draft

[storage/qmdb] specialize the (common) k=2 case in apply_batch#3769
roberto-bayardo wants to merge 4 commits into
unsafe-index-2from
specialize-depth-2

Conversation

@roberto-bayardo
Copy link
Copy Markdown
Collaborator

Benchmark Time Change vs without k=2
apply_batch/uncomm_ancestor 2.19 ms -9.2%
apply_batch/comm_uncomm_chain 3.10 ms -4.8%

roberto-bayardo and others added 4 commits May 12, 2026 14:29
Replace the 7-variant Phase state machine with a simpler 3-state enum
and raw pointer traversal. The new Cursor operates on the linked list
in-place instead of detaching visited nodes into a "past" accumulator
and reattaching on Drop.

Also fixes a minor bug in previous impl and adds a regression test.
Exercises the full Cursor lifecycle (next, find, delete, insert, drop)
on every key, revealing the ~59% speedup from the Cursor simplification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
commonware-mcp 431da8c May 12 2026, 10:39 PM

@github-actions
Copy link
Copy Markdown

Benchmark results

Tip

PASSED: No benchmark exceeded the regression threshold.

Benchmark comparison table
Benchmark Baseline (main) Current Delta Threshold Status
qmdb::merkleize/variant=any::unordered::fixed::mmr keys=10000 ch=false sync=false 1.685 ms 1.543 ms -8.45% 10.00% ✅ PASS
qmdb::merkleize/variant=current::ordered::fixed::mmb chunk=256 keys=10000 ch=true sync=false 2.945 ms 2.874 ms -2.42% 10.00% ✅ PASS

Baseline commit(s): 2bb26b035e72

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 97.72727% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.81%. Comparing base (61ef0d7) to head (431da8c).

Files with missing lines Patch % Lines
storage/src/qmdb/any/batch.rs 97.72% 1 Missing ⚠️
@@               Coverage Diff               @@
##           unsafe-index-2    #3769   +/-   ##
===============================================
  Coverage           95.81%   95.81%           
===============================================
  Files                 472      472           
  Lines              187594   187629   +35     
  Branches             4443     4443           
===============================================
+ Hits               179749   179783   +34     
- Misses               6411     6413    +2     
+ Partials             1434     1433    -1     
Files with missing lines Coverage Δ
storage/src/qmdb/any/batch.rs 97.03% <97.72%> (+<0.01%) ⬆️

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61ef0d7...431da8c. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant